!include "Sections.nsh"

!define ProjectRoot ../..

Name "Guishell"
OutFile "..\guishell-cygwin.exe"
InstallDir "$PROGRAMFILES\Guishell"

Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles

Var /GLOBAL CygwinRoot

Function findCygwin
		ClearErrors
		ReadRegStr $CygwinRoot HKCU "Software\Cygnus Solutions\Cygwin\mounts v2\/" "native"
		IfErrors checkGlobalCygwinInstall foundCygwin
		
	checkGlobalCygwinInstall:
		ReadRegStr $CygwinRoot HKLM "Software\Cygnus Solutions\Cygwin\mounts v2\/" "native"
		IfErrors cygwinNotInstalled foundCygwin
		
	foundCygwin:
		Return
		
	cygwinNotInstalled:
		MessageBox MB_OK "Cygwin is not installed"
		Abort
FunctionEnd

Function .onInit
	Call findCygwin
FunctionEnd

Section
	SetOutPath $INSTDIR
	File ..\..\term\release\guishell_term.exe
	File ..\..\shell\guishell_sh.exe
	File ..\..\frontend\guishell.exe
	File QtCore4.dll
	File QtGui4.dll
SectionEnd

Section "Add to Cygwin path"
SectionEnd

Section "Add Desktop Icon"
	SetOutPath "$CygwinRoot\bin"
	CreateShortcut "$DESKTOP\Guishell.lnk" "$INSTDIR\guishell_term.exe" "" "$CygwinRoot\cygwin.ico"
SectionEnd

Section "Add Start Menu Icon"
	SetOutPath "$CygwinRoot\bin"
	CreateShortcut "$SMPROGRAMS\Guishell.lnk" "$INSTDIR\guishell_term.exe" "" "$CygwinRoot\cygwin.ico"
SectionEnd

Section "un.Uninstaller Section"
SectionEnd

